function g1 = dynamic_g1(T, y, x, params, steady_state, it_, T_flag)
% function g1 = dynamic_g1(T, y, x, params, steady_state, it_, T_flag)
%
% File created by Dynare Preprocessor from .mod file
%
% Inputs:
%   T             [#temp variables by 1]     double   vector of temporary terms to be filled by function
%   y             [#dynamic variables by 1]  double   vector of endogenous variables in the order stored
%                                                     in M_.lead_lag_incidence; see the Manual
%   x             [nperiods by M_.exo_nbr]   double   matrix of exogenous variables (in declaration order)
%                                                     for all simulation periods
%   steady_state  [M_.endo_nbr by 1]         double   vector of steady state values
%   params        [M_.param_nbr by 1]        double   vector of parameter values in declaration order
%   it_           scalar                     double   time period for exogenous variables for which
%                                                     to evaluate the model
%   T_flag        boolean                    boolean  flag saying whether or not to calculate temporary terms
%
% Output:
%   g1
%

if T_flag
    T = CIA.dynamic_g1_tt(T, y, x, params, steady_state, it_);
end
g1 = zeros(8, 18);
g1(1,4)=(-((1-params(2)+y(13))/y(12)));
g1(1,12)=(-((-(y(4)*(1-params(2)+y(13))))/(y(12)*y(12))));
g1(1,13)=(-(y(4)/y(12)));
g1(2,4)=(-(params(8)*y(9)))/(y(4)*y(9)*y(4)*y(9));
g1(2,14)=(-((-((-params(1))*y(15)*y(16)))/(y(15)*y(14)*y(16)*y(15)*y(14)*y(16))));
g1(2,9)=(-(y(4)*params(8)))/(y(4)*y(9)*y(4)*y(9));
g1(2,15)=(-((-((-params(1))*y(14)*y(16)))/(y(15)*y(14)*y(16)*y(15)*y(14)*y(16))));
g1(2,16)=(-((-((-params(1))*y(15)*y(14)))/(y(15)*y(14)*y(16)*y(15)*y(14)*y(16))));
g1(3,6)=y(9);
g1(3,9)=y(6);
g1(4,4)=(-y(8));
g1(4,5)=(-y(1));
g1(4,1)=(-(1-params(2)+y(5)));
g1(4,7)=1;
g1(4,8)=(-y(4));
g1(4,9)=(-1)/(y(9)*y(9));
g1(5,4)=1;
g1(5,7)=(-((1-params(3))*y(11)*1/y(8)*T(4)));
g1(5,8)=(-((1-params(3))*y(11)*T(4)*(-y(7))/(y(8)*y(8))));
g1(5,11)=(-((1-params(3))*T(2)));
g1(6,5)=1;
g1(6,7)=(-(params(3)*y(11)*1/y(8)*T(5)));
g1(6,8)=(-(params(3)*y(11)*T(5)*(-y(7))/(y(8)*y(8))));
g1(6,11)=(-(params(3)*T(3)));
g1(7,2)=(-(params(7)*1/y(2)));
g1(7,10)=1/y(10);
g1(7,18)=(-1);
g1(8,3)=(-(params(6)*1/y(3)));
g1(8,11)=1/y(11);
g1(8,17)=(-1);

end
